﻿@model IEnumerable<Kavaa.Modules.PortailMedical.Entity.Accreditation>
@using System.Web.Optimization
@using BootstrapSupport
@using NavigationRoutes

@{
    ViewBag.Title = "Accreditations";
    Layout =null;
}



           <script>
               var rowId;

               /* Table initialisation */
               $(document).ready(function () {
                   $('#example').dataTable({
                       "sDom": "<'row'<'span4'l><'span4'f>r>t<'row'<'span4'i><'span4'p>>",
                       "sPaginationType": "bootstrap"
                   });
               });



               function reject() {

                   $('.mytable tr').click(function (e) {
                       rowId = $(this).attr('id');
                   });

               }
               function reject2() {

                   $.ajax({
                       url: '/Clinique/RejectAccredit',//ça marche
                       async: false,
                       type: 'POST',
                       data: { idAccredit: rowId },
                       success: function () {
                           $('#reject').attr('data-dismiss', 'modal');
                           $('#lala').load('/Clinique/TraiterAccredit');
                       }
                   });
                   document.getElementById("t").style.display = "block";

               }

               function confirm() {
                   $('.mytable tr').click(function (e) {
                       rowId = $(this).attr('id');

                   });


               }

               function confirm2() {

                   $.ajax({
                       url: '/Clinique/ConfirmAccredit',//ça marche
                       async: false,
                       type: 'POST',
                       data: { idAccredit: rowId },
                       success: function () {
                           $('#confirm').attr('data-dismiss', 'modal');
                           $('#lala').load('/Clinique/TraiterAccredit');
                       }
                   });
                   document.getElementById("t").style.display = "block";

               }
        </script>

       <div id="tt" class = "alert alert-success" style="margin-left:22px; margin-right:700px;display:none">
          
   <button type="button" class="close" data-dismiss="alert">&times;</button>
  <div id="tttt"> Votre traitement de la demande a été bien enregistrée. </div>
   
</div>   
       
     <div id="lala">
    
    <div style="margin-left:50px; margin-right:300px;">

                   
<table class="mytable table table-striped table-bordered" id="example">

  <thead>   
         <tr></tr> 
        <tr></tr>  
		<tr>
        <th>INP</th>
			<th>Medecin</th>
			<th>Acte</th>
			<th>Date de demande </th>
            <th>Traitement</th>
            
		</tr>
	</thead>
	<tbody>

@foreach (var item in Model)
{
    
    <tr id=@item.Id>
          <td >
    
        
            @Html.DisplayFor(modelItem => item.Medecin.INP)
           
        </td>
        <td >
    
        
           Dr.&nbsp; @Html.DisplayFor(modelItem => item.Medecin.Name)&nbsp;@Html.DisplayFor(modelItem => item.Medecin.Prenom)
           
        </td>
        <td>
           @Html.DisplayFor(modelItem => item.Acte.Name) 
               </td>
            
       <td>
         @Html.DisplayFor(modelItem => item.Date)<br />
         
         
             </td>
       

          
        <td>
           @{var tata = @item.Id;} @*<input  onclick="confirm()" />*@

            
                 <a href="#popup_Confirm" data-toggle="modal"> <button  style="background-color:green" onclick="confirm()"  class="btn btn-custom"><i class="icon-white icon-ok"></i> Confirmer</button> </a>      <a href="#popup_Reject" data-toggle="modal"> <button style="background-color:red" onclick="reject()"  class="btn btn-custom2"><i class=" icon-remove"></i> Rejeter</button></a>
           <br />
           @*  @using (Ajax.BeginForm("TraiterAccredit", "Clinique", new AjaxOptions { UpdateTargetId = "lala" , OnSuccess="totooo"}))
      {
            *@
     
              
     @* //}*@
          
             </td>

      
   
    </tr>
     
    
}

        
   
</tbody>
</table>

       <div id="popup_Reject" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="popupLabel" aria-hidden="true" >
          
               <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                
              </div>
              <br /><br />
              <div id="msgSupp" style="padding-left:10px" > Voulez-vous vraiment rejeter cette demande ?</div>
              <br /><br />
               <div class="modal-footer">
           <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button>
           <button id= "reject" class="btn btn-primary" onclick="reject2()"> Rejeter</button>
            </div>
              </div> 
      
       <div id="popup_Confirm" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="popupLabel"  aria-hidden="true" >
          
               <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                
              </div>
              <br /><br />
              <div style="padding-left:10px" >Voulez-vous vraiment confirmer cette demande ?</div>
              <br /><br />
               <div class="modal-footer">
           <button class="btn" data-dismiss="modal" aria-hidden="true" >Annuler</button>
         <button id="confirm" class="btn btn-primary" onclick="confirm2()" > Confirmer </button>
         
            </div>
         
              </div>       
         <br />
        </div>
</div>

  
  
  
  



 
            
        
      
